#include "BoxerFactory.h"


BoxerFactory::BoxerFactory(void)
{
}


BoxerFactory::~BoxerFactory(void)
{
}

Boxer * BoxerFactory::CreateBoxer()
{
	return new Boxer();
}

char *BoxerFactory::SetName()
{
	NameGenerator ng;
	return ng.GetName();
}

int  BoxerFactory::SetSkills(Boxer *aB,  skill aSkillMaxPoint)
{
	if(!aB) return 0;
	int i=REFLEX;
	while(i && aSkillMaxPoint){
		unsigned points;
		points=rand() % aSkillMaxPoint;
		aB->mSkills[i]=points;
		aSkillMaxPoint= aSkillMaxPoint-points;
		i--;
	}
	while(i>=0){
		aB->mSkills[i]=aSkillMaxPoint;
		i--;
	}
	return 1;
}

int BoxerFactory::SetHitPoints(Boxer *aB, int aHitPoints)
{
	if(!aB) return 0;
	aB->SetHitPoints(aHitPoints+aB->mSkills[RESISTANCE]);
	return 1;

}

void BoxerFactory::ViewStats( Boxer*  const aB)
{ 
	std::cout << std::endl<< std::endl;
	std::cout <<".............................."<<std::endl;
	std::cout <<"Boxer: "            << aB->GetName()           << std::endl;
	std::cout <<"Punti Esperienza: " << aB->GetPx()             << std::endl;
	std::cout <<"Punti Vita: "       << aB->GetHitPoints()      << std::endl;
	std::cout <<"Strength: "         << aB->mSkills[STRENGTH]   << std::endl;
	std::cout <<"Resistance: "       << aB->mSkills[RESISTANCE] << std::endl;
	std::cout <<"Speed: "            << aB->mSkills[SPEED]      << std::endl;
	std::cout <<"Reflex: "           << aB->mSkills[REFLEX]     << std::endl;
}

